package day0721;

import java.util.ArrayList;

public class Test7 {
    public static void main(String[] args) {
        //ArrayList集合存储字符串，然后用循环进行反转
        ArrayList<String>  list=new ArrayList<>();
        list.add("A");//0   (4-1)-0
        list.add("B");//1   (4-1)-1
        list.add("C");//2   (4-1)-2
        list.add("D");//3   (4-1)-3



        for(int i=0;i<list.size()/2;i++){
            String s=list.get(i);
            String old=list.set( list.size()-1-i, s );
            list.set(i,old);
        }
        System.out.println(list);
    }
}
